/*
 * (c) 2007, Delsi Interactive
 * User: Usuario Deltatek
 * Date: 25/04/2007
 * Time: 08:36 p.m.
 */

using System;
using System.Drawing;
using System.Windows.Forms;

namespace CSE
{
	/// <summary>
	/// Description of NewClip.
	/// </summary>
	public partial class NewClip : Form
	{
		/*
		 * Variables
		 */
		public static string tnSel = "";
		
		/*
		 * Constructor
		 */
		public NewClip()
		{
			MainForm.self.Enabled = false;
			tnSel = "";
			InitializeComponent();
			
			this.Location = new Point (MainForm.self.Location.X + (MainForm.self.Width / 2) - (this.Width / 2),
			                           MainForm.self.Location.Y + (MainForm.self.Height / 2) - (this.Height / 2));
			
			
			this.Show(MainForm.self);
			this.Focus();
		}
		
		/*
		 * UnloadMe
		 */
		private void UnloadMe ()
		{
			MainForm.self.Enabled = true;
			this.Dispose();
			MainForm.nc = null;
		}
		
		/*
		 * Ok
		 */
		void BtnOkClick(object sender, EventArgs e)
		{
			if (this.txtName.Text.Length < 1)
			{
				Utils.MsgBox("Please, put at least one name for this clip!");
			}
			else
			{
				if (this.chkIsStatic.Checked)
				{
					Workspace.NewClip(Workspace.TYPE_CLIP, this.txtName.Text, this.chkUseBitmap.Checked);
				}
				else
				{
					Workspace.NewClip(Workspace.TYPE_ANIMCLIP, this.txtName.Text, this.chkUseBitmap.Checked);
				}
				UnloadMe();
			}
		}
		
		/*
		 * Cancel
		 */
		void BtnCancelClick(object sender, EventArgs e)
		{
			UnloadMe();
		}
	}
}
